package mxm.amfire;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import me.yokeyword.fragmentation.SupportFragment;

/**
 * Created by zengpeijin on 2017/2/17.
 */

public class LogoInfoTextFragment extends SupportFragment {
    private View rootView;
    private ImageView imageView;
    private TextView textView;
    private String name;
    private int res;

    public static LogoInfoTextFragment newInstance(String name, int res) {
        LogoInfoTextFragment fragment = new LogoInfoTextFragment();
        Bundle bundle = new Bundle();
        bundle.putString("name", name);
        bundle.putInt("res", res);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        if(bundle!=null){
            name=bundle.getString("name","");
            res=bundle.getInt("res");
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_logoinfo_text, container, false);
        initView();
        get();
        return rootView;
    }

    private void initView() {
        imageView = (ImageView) rootView.findViewById(R.id.imageView);
        textView = (TextView) rootView.findViewById(R.id.textView);
        textView.setText(name);
        imageView.setImageResource(res);
    }
    private void get(){

    }
}
